<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="flv.min.js"></script>
  </head>
  <body>
    <video
      id="videoElement"
      controls
      autoplay
      width="1280"
      height="720"
    ></video>
    <script>
      if (flvjs.isSupported()) {
        var videoElement = document.getElementById("videoElement");
        var flvPlayer = flvjs.createPlayer({
          type: "flv",
          isLive: true,
          url: "ws://localhost:8080/live", // WebSocket 服务器地址和流路径
        });
        flvPlayer.attachMediaElement(videoElement);
        flvPlayer.load();
        flvPlayer.play();
      } else if (Hls.isSupported()) {
        // 如果不支持 FLV.js，可以考虑使用其他播放器库（如 hls.js）
      } else {
        console.error("Your browser does not support FLV.js");
      }
    </script>
  </body>
</html>
